import request from './apiRequest.js'
import {
  uploadFile
} from './apiRequest.js'

const DOMAIN1 = 'https://zhj1214.club';


/**
 * 获取openId
 */
var getOpenId = function(options) {
  return request({
    method: "GET",
    url: DOMAIN1 + '/phoneWork/login/login',
    header: {
      'content-type': 'application/json' // 默认值
      
    },
    data: options,
  })
}

/**
 * 获取手机信息接口
 */
var getPhones = function(options) {
  return request({
    url: DOMAIN1 + '/phoneWork/info/phoneInfo',
    data: options,
    method: "GET",
    header: {
      'content-type': 'application/json', // 默认值
      'token': wx.$localStorage.get('logintoekn')
    }
  })
}

/**
 * 获取 维修信息
 */
var getMaintenanceList = function(options) {
  return request({
    url: DOMAIN1 + '/phoneWork/info/repairInfo',
    data: options,
    method: "GET",
    header: {
      'content-type': 'application/json', // 默认值
      'token': wx.$localStorage.get('logintoekn')
    }
  })
}

/**
 * 获取 报价
 * /phoneWork/info / repairFeeInfo ? phoneId =***& repairType=***
 */

var getPhoneRepairFeeInfo = function(options) {
  return request({
    url: DOMAIN1 + '/phoneWork/info/repairFeeInfo',
    data: options,
    method: "GET",
    header: {
      'content-type': 'application/json', // 默认值
      'token': wx.$localStorage.get('logintoekn')
    }
  })
}

/**
 * 插入手机信息、post方法
 */
var addPhoneInfoData = function(options) {
  return request({
    url: DOMAIN1 + '/phoneWork/info/insertPhoneInfo',
    data: options,
    method: "POST",
    header: {
      'content-type': 'application/json', // 默认值
      'token': wx.$localStorage.get('logintoekn')
    }
  })
}

/**
 * 插入维修费用信息/post方法
 */
var addRepairInfoData = function(options) {
  return request({
    url: DOMAIN1 + '/phoneWork/info/insertRepairInfo',
    data: options,
    method: "POST",
    header: {
      'content-type': 'application/json', // 默认值
      'token': wx.$localStorage.get('logintoekn')
    }
  })
}

/**
 * 预约下单
 */
var submitPhoneOrderInfo = function(options) {
  return request({
    url: DOMAIN1 + '/phoneWork/order/submit',
    data: options,
    method: "POST",
    header: {
      'content-type': 'application/json', // 默认值
      'token': wx.$localStorage.get('logintoekn')
    }
  })
}

/**
 * 查询记录
 */

var queryOrderInfo = function(options) {
  return request({
    url: DOMAIN1 + '/phoneWork/order/query',
    data: options,
    method: "GET",
    header: {
      'content-type': 'application/json', // 默认值
      'token': wx.$localStorage.get('logintoekn')
    }
  })
}

/**
 * 查询记录
 */
var queryAllOrderInfo = function(options) {
  return request({
    url: DOMAIN1 + '/phoneWork/order/queryAll',
    data: options,
    method: "GET",
    header: {
      'content-type': 'application/json', // 默认值
      'token': wx.$localStorage.get('logintoekn')
    }
  })
}

var queryBannerList = function (options) {
  return request({
    url: DOMAIN1 + '/phoneWork/picture/getRotaryPicture',
    data: options,
    method: "GET",
    header: {
      'content-type': 'application/json', // 默认值
      'token': wx.$localStorage.get('logintoekn')
    }
  })
}

  
/**
 * 获取手机号、上传用户信息
 */
var getUserPhone = function(options) {
  return request({
    url: DOMAIN1 + '/phoneWork/login/updateUser',
    data: options,
    method: "POST",
    header: {
      'content-type': 'application/json', // 默认值
      'token': wx.$localStorage.get('logintoekn')
    }
  })
}

/**
 * 收集 formId
 */
var collectFormIdData = function(options) {
  return request({
    url: DOMAIN1 + '/phoneWork/order/saveFormId',
    data: options,
    method: "POST",
    header: {
      'content-type': 'application/json', // 默认值
      'token': wx.$localStorage.get('logintoekn')
    }
  })
}

module.exports = {
  getOpenId,
  getPhones,
  getMaintenanceList,
  getPhoneRepairFeeInfo,
  addPhoneInfoData,
  addRepairInfoData,
  submitPhoneOrderInfo,
  queryOrderInfo,
  queryAllOrderInfo,
  queryBannerList,
  getUserPhone,
  collectFormIdData
};